<?php
/**
 * 管理标签页面
 * $Id: manage_tags.php 192 2010-11-04 07:52:58Z bwanglei@gmail.com $
 */

require_once './globals.php';
require_once AW_ROOT.'/model/class.tag.php';

$blog_title = '管理标签 - '.$blogname;
$aw_tag = new awTag();
$tags = $CACHE->readCache('tags');

if ($action=='manage-tag' && $_SERVER['REQUEST_METHOD']=='POST') {
	if (isset($_POST['del_tag']) && $_POST['del_tag']=='true') {
		$name_del_tag = $_POST['old_name_tag'];
		$aw_tag->deleteTag($name_del_tag);
	} else {
		$old_name_tag = $_POST['old_name_tag'];
		$new_name_tag = $_POST['name_tag'];
		$aw_tag->updateTagName($old_name_tag, $new_name_tag);
	}
	$CACHE->updateCache('tags');
	$page = (isset($_GET['page']) ? ('?page='.abs(intval($_GET['page']))) : '');
	header('Location: '.$blogUrl.'/admin/manage_tags.php'.$page);exit;
}
include_once TEMPLATE_PATH.'/header.php';
include_once TEMPLATE_PATH.'/manage_tags.php';
include_once TEMPLATE_PATH.'/sidebar.php';
include_once TEMPLATE_PATH.'/footer.php';
